﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace JWUX.Supermarket.Model
{
    public class BOMInfo
    {
        #region 成员

        private List<MaterialItem> _materials;

        #endregion

        #region 构造函数

        public BOMInfo()
        {
            //_materials = new List<MaterialItem>();
        }

        #endregion

        #region 属性

        public decimal ModelId
        {
            get;
            set;
        }

        public List<MaterialItem> Materials
        {
            set { _materials = value; }
            get
            {
                if (_materials == null)
                {
                    _materials = new List<MaterialItem>();
                }
                return _materials;
            }
        }

        #endregion

        #region 方法

        /// <summary>
        /// 获取指定工位需要的物料信息
        /// </summary>
        /// <param name="locationId">工位Id</param>
        /// <returns></returns>
        public List<MaterialItem> FindLocation(int locationId)
        {
            return _materials.FindAll(delegate(MaterialItem m) { return m.Station.Id == locationId; });
        }

        #endregion
    }
}
